#!/usr/bin/python
# -*-coding:UTF-8 -*-

# ========================
# @Time  : 2021/1/21
# @Author: Sunny
# ========================


#三目运算
number = 100
if number >60:
    print('大于')
else:
    print('小于')

res =True if number >60 else False
print(res)


#需求，生成[py1...py20]
li = []
for i in range(1,21):
    li.append('py{}'.format(i))
print(li)

#列表推导式
c = [f'py{i}' for i in range(1,21)]
print(c)

#集合推导式
se = {f'py{i}' for i in range(1,21)}
print(se)

#字典推导式
one_dict = {f'name{i}':i for i in range(1,21)}
print(one_dict)


cook_str = 'BIDUPSID=D0727533D7147B7;PSTM=1530348042;BAIDUID=B1005C9BC2EB28;sugstore=0;__cfduid=d0a13458f8ac2a;BD_UPN=12314353;ispeed_lsm=2;BDORZ=B490B5EBF6F3CD402'

#1.先执行cook_str.split(';')进行分割
#2.再执行for循环赋值给i
#3.再将i进行分割，变成字典
dict2 = {i.split('=')[0]:i.split('=')[1] for i in cook_str.split(';')}
print(dict2)